<?php
class BaseModelParams {
	protected static $instance = NULL;
	protected static $get      = NULL;
	protected static $post     = NULL;
	protected static $com      = NULL;

    private function __construct(){
        return;
    }

	public function __init() {
		 self::$get  = &$_GET;
		 self::$post = &$_POST;


		 foreach( self::$get as $key => $value ) {
			self::$com[$key] = self::$get[$key];
		 }
		 foreach( self::$post as $key => $value ) {
			self::$com[$key] = self::$post[$key];
		 }
         //firePHP::getInstance(true)->log(self::$com, 'log');
	}
	public static function instance() {
		if( !self::$instance ) {
			self::$instance = new BaseModelParams();
			self::$instance->__init();
		}
		return self::$instance;
	}
	public static function get($key=NULL) {
		self::$instance = BaseModelParams::instance();
		return $key ? self::$com[$key] : self::$com;
	}
	public static function set($key,$value) {
		self::$instance = BaseModelParams::instance();
		return self::$com[$key] = $value;
	}
	public static function getGet($key=NULL) {
		self::$instance = BaseModelParams::instance();
		return $key ? self::$get[$key] : self::$get;
	}
	public static function setGet($key,$value) {
		self::$instance = BaseModelParams::instance();
		self::set($key,$value);
		return self::$get[$key] = $value;
	}
	public static function getPost($key=NULL) {
		self::$instance = BaseModelParams::instance();
		return $key ? self::$post[$key] : self::$post;
	}
	public static function setPost($key,$value) {
		self::$instance = BaseModelParams::instance();
		self::set($key,$value);
		return self::$post[$key] = $value;
	}
}
?>
